import os
import datetime
import logging


currentpath = os.path.dirname(os.path.abspath(__file__))
loggerpath = currentpath + "\\" + "log"

filename = datetime.datetime.now().strftime("%Y%m%d_%H%M")+".logs"

loggername = os.path.join(loggerpath,filename)

logger = logging.getLogger()
logger.setLevel(logging.INFO)
logger_hander = logging.FileHandler(loggername)
formator = logging.Formatter(" %(asctime)s--%(message)s")
logger_hander.setFormatter(formator)
logger.addHandler(logger_hander)
logger.info("it is info messsage")
logger_hander.close()
logger.removeHandler(logger_hander)
